/*
 *  Copyright 2004 Blandware (http://www.blandware.com)
 *
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 */
package com.blandware.atleap.service.core;

import com.blandware.atleap.model.core.GlobalProperty;
import com.blandware.atleap.service.exception.BeanNotFoundException;

import java.util.List;
import java.util.Properties;

/**
 * <p>Business Delegate (Proxy) Interface to handle communication between web and
 * persistence layer.
 * </p>
 * <p>
 * All global properties are divided into 2 classes: <em>static</em> and <em>dynamic</em> properties.
 * Static properties are defined in configuration files and cannot be changed
 * from the application. Dynamic properties are defined in configuration files
 * too, but they can be overrided by the user in the application. So their values
 * in configuration files are just initial values.
 * </p>
 * <p><a href="GlobalPropertyManager.java.html"><i>View Source</i></a>
 * </p>
 *
 * @author Sergey Zubtsovskiy <a href="mailto:sergey.zubtsovskiy@blandware.com">&lt;sergey.zubtsovskiy@blandware.com&gt;</a>
 * @author Andrey Grebnev <a href="mailto:andrey.grebnev@blandware.com">&lt;andrey.grebnev@blandware.com&gt;</a>
 * @version $Revision: 1.10 $ $Date: 2006/08/03 10:07:41 $
 */
public interface GlobalPropertyManager extends BaseManager {


	/**
	 * Loads dynamic properties. Those properties that do not exist more are
     * deleted from the persistent storage. This can also 'roll back' values of
     * properties in persistent storage to those that are in configuration files.
     *
	 * @param overrideDynamicValues Whether or not to replace dynamically changed values with ones from configuration file
     * @return dynamic properties
	 */
	public Properties loadDynamicProperties(boolean overrideDynamicValues);

	/**
	 * Retrieves global property object with specified name
	 *
	 * @param propertyName Name of propery to retrieve
	 * @return Global property object or null if none was found
	 */
	public GlobalProperty retrieveGlobalProperty(String propertyName);

	/**
	 * Returns static properties
	 * @return Static properties
	 */
	public Properties getStaticProperties();

	/**
	 * Updates global property
	 *
	 * @param globalProperty Property to update
	 * @throws BeanNotFoundException if some property couldn't be found
	 */
	public void updateProperty(GlobalProperty globalProperty) throws BeanNotFoundException;

	// ~ Additional methods ================================================================

	/**
	 * Retrieves list of dynamic global properties.
	 *
	 * @return List of dynamic global properties
	 */
	public List listDynamicProperties();

}